package game.map
{
	import assets.Assets;
	import flash.geom.Point;
	import game.VO.MapObjectVO;
	import starling.display.Image;
	import starling.textures.Texture;
	
	/**
	 * ...
	 * @author Kirill Pletnev
	 */
	public class MapObject extends Image
	{
		public static const DIRECTION_SOUTH:int = 0;
		public static const DIRECTION_WEST:int = 1;
		public static const DIRECTION_NORTH:int = 2;
		public static const DIRECTION_EAST:int = 3;
		
		protected var _mapObjectVO:MapObjectVO;
		
		public function MapObject(mapObjectVO:MapObjectVO)
		{
			var textureName:String = mapObjectVO.textureURL;
			var texture:Texture = Assets.instance.getTexture(textureName)
			
			_mapObjectVO = mapObjectVO;
			setPhysicalFlags(mapObjectVO);
			
			super(texture);
		
		}
		
		public function setPhysicalFlags(mapObjectVO:MapObjectVO):void
		{
			var columnPosition:int = _mapObjectVO.columnPosition;
			var rowPosition:int = _mapObjectVO.rowPosition;
			
			var physicalFlags:Vector.<int> = mapObjectVO.physicalFlags;
			
			for (var index:int = 0; index < physicalFlags.length; index++)
			{
				var physicalFlag:int = physicalFlags[index];
				var position:Point = PhysicalMap.getTilePoint(index, columnPosition, rowPosition);
					//Game.instance.physicalMap.setTileFlags(position.x, position.y, physicalFlag);
			}
		}
	
	}

}